package org.example.yidaiyilu.entity;

import java.util.ArrayList;
import java.util.List;

public class CiTiao {

    private String cimu = null;

    private String pinyin = null;

    private String yixiang_header = null;

    private List<YiXiang> yixiangList =new ArrayList<YiXiang>();

    private String zhuyi = null;

    public void setCimu(String cimu) {
        this.cimu = cimu;
    }

    public void setYixiang_header(String yixiang_header) {
        this.yixiang_header = yixiang_header;
    }

    public void setPinyin(String pinyin) {
        this.pinyin = pinyin;
    }

    public void setYiXiangList(List<YiXiang> yixiangList) {
        this.yixiangList = yixiangList;
    }

    public List getYiXiangList() {
        return this.yixiangList;
    }


    public void setZhuyi(String zhuyi) {
        this.zhuyi = zhuyi;
    }

    public String toString(){
        StringBuilder sb = new StringBuilder();
        sb.append("<词条>");
        if(cimu != null && !"".equals(cimu)){
            sb.append("<词目>").append(cimu.trim()).append("</词目>");
        }
        if(pinyin != null && !"".equals(pinyin)){
            sb.append("<拼音>").append(pinyin.replace("ɡ","g").replace("ɑ","a").trim()).append("</拼音>");
        }
        if(yixiang_header != null && !"".equals(yixiang_header)){
            sb.append("<义项前缀>").append(yixiang_header.trim()).append("</义项前缀>");
        }
        for(int i=0; i<yixiangList.size(); i++){
            sb.append(yixiangList.get(i).toString());
        }
        if(zhuyi != null && !"".equals(zhuyi)){
            sb.append("<注意>").append(zhuyi.trim()).append("</注意>");
        }

        sb.append("</词条>");
        return sb.toString();
    }



}
